In [1]:
import matplotlib.pyplot as plt
from numpy import sqrt,cos,sin,pi,arange
from qutip import *
In [2]:
H = Qobj([[1],[0]])
V = Qobj([[0],[1]])
P45 = Qobj([[1/sqrt(2)],[1/sqrt(2)]])
M45 = Qobj([[1/sqrt(2)],[-1/sqrt(2)]])
R = Qobj([[1/sqrt(2)],[-1j/sqrt(2)]])
L = Qobj([[1/sqrt(2)],[1j/sqrt(2)]])
We already have the $|H\rangle$ state represented as a vector in the HV basis, so the $\hat{P}_H$ operator is the outer product $|H\rangle\langle H|$:
In [3]:
Ph = H*H.dag()
Ph
Out[3]:
Same with the $\hat{P}_V$ operator:
In [4]:
Pv = V*V.dag()
Pv
Out[4]:
In [ ]:
In [5]:
def Rp(theta):
return Qobj([[cos(theta),-sin(theta)],[sin(theta),cos(theta)]]).tidyup()
In [6]:
Rp(pi/2)
Out[6]:
In [7]:
V == Rp(pi/2)*H
Out[7]:
In [ ]:
In [8]:
def sim_transform(o_basis1, o_basis2, n_basis1, n_basis2):
a = n_basis1.dag()*o_basis1
b = n_basis1.dag()*o_basis2
c = n_basis2.dag()*o_basis1
d = n_basis2.dag()*o_basis2
return Qobj([[a.data[0,0],b.data[0,0]],[c.data[0,0],d.data[0,0]]])
In [9]:
Shv45 = sim_transform(H,V,P45,M45) # as found in Example 4.A.1, Eq. 4.A.10.
Shv45
Out[9]:
In [10]:
Shv45 * L # compare to Eq.
Out[10]:
In [11]:
Shv45*Ph*Shv45.dag()
Out[11]:
In [ ]: